package com.tbsoft.ehr.login;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

/**
 * @desc 登录信息
 * @author vastdream
 *
 */
public class LoginInfo implements Serializable {

	private static final long serialVersionUID = 1L;
	private String userId;
	private Set<RoleInfo> roleSet = new HashSet<RoleInfo>();
	private String userName;
	private String forwardUrl;
	public String getForwardUrl() {
		return forwardUrl;
	}
	public void setForwardUrl(String forwardUrl) {
		this.forwardUrl = forwardUrl;
	}
	public String getUserId() {
		return userId;
	}
	public void setUserId(String userId) {
		this.userId = userId;
	}
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	@Override
	public String toString() {
		return userId+":"+userName;
	}
	public synchronized Set<RoleInfo> getRoleSet() {
		return roleSet;
	}
	public synchronized void setRoleSet(Set<RoleInfo> roleSet) {
		this.roleSet = roleSet;
	}
	public synchronized boolean isRole(String roleId){
		boolean rt = false;
		for(RoleInfo ri :roleSet){
			if(ri.getRoleId().equals(roleId)){
				rt = true;
				break;
			}
		}
		return rt;
	}
	
}
